package com.ruoyi.product.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import org.apache.commons.math3.analysis.function.Add;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.product.mapper.AddressMapper;
import com.ruoyi.product.domain.Address;
import com.ruoyi.product.service.IAddressService;

/**
 * 地址信息Service业务层处理
 *
 * @author 林道敬
 * @date 2025-01-04
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService
{
    @Autowired
    private AddressMapper addressMapper;

    /**
     * 查询地址信息
     *
     * @param id 地址信息主键
     * @return 地址信息
     */
    @Override
    public Address selectAddressById(String id)
    {
        return addressMapper.selectAddressById(id);
    }

    /**
     * 查询地址信息列表
     *
     * @param address 地址信息
     * @return 地址信息
     */
    @Override
    public List<Address> selectAddressList(Address address)
    {
        return addressMapper.selectAddressList(address);
    }

    /**
     * 新增地址信息
     *
     * @param address 地址信息
     * @return 结果
     */
    @Override
    public int insertAddress(Address address)
    {
        address.setCreateTime(DateUtils.getNowDate());
        return addressMapper.insertAddress(address);
    }

    /**
     * 修改地址信息
     *
     * @param address 地址信息
     * @return 结果
     */
    @Override
    public int updateAddress(Address address)
    {
        return addressMapper.updateAddress(address);
    }

    /**
     * 批量删除地址信息
     *
     * @param ids 需要删除的地址信息主键
     * @return 结果
     */
    @Override
    public int deleteAddressByIds(String[] ids)
    {
        return addressMapper.deleteAddressByIds(ids);
    }

    /**
     * 删除地址信息信息
     *
     * @param id 地址信息主键
     * @return 结果
     */
    @Override
    public int deleteAddressById(String id)
    {
        return addressMapper.deleteAddressById(id);
    }
}
